home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
dskut
/
patch12.zip
/
CONFIGUR.E
< prev
next >
Wrap
Text File
|
1990-05-30
|
32KB
|
1,422 lines
#! /bin/sh
#
# If these # comments don't work, trim them. Don't worry about any other
# shell scripts, Configure will trim # comments from them for you.
#
# (If you are trying to port this package to a machine without sh, I would
# suggest you cut out the prototypical config.h from the end of Configure
# and edit it to reflect your system. Some packages may include samples
# of config.h for certain machines, so you might look for one of those.)
#
# $Header: Head.U,v 1.0 87/05/22 12:28:10 lwall Exp $
#
# Yes, you may rip this off to use in other distribution packages.
# (Note: this Configure script was generated automatically. Rather than
# working with this copy of Configure, you may wish to get metaconfig.)
: sanity checks
PATH='.:/bin:/usr/bin:/usr/local/bin:/usr/ucb:/usr/local:/usr/lbin:/etc:/usr/new:/usr/new/bin:/usr/nbin'
export PATH || (echo "OOPS, this isn't sh. Desperation time. I will feed myself to sh."; sh $0; kill $$)
if test ! -t 0; then
echo "Say 'sh Configure', not 'sh <Configure'"
exit 1
fi
(alias) >/dev/null 2>&1 && \
echo "(I see you are using the Korn shell. Some ksh's blow up on Configure," && \
echo "especially on exotic machines. If yours does, try the Bourne shell instead.)"
if test ! -d ../UU; then
if test ! -d UU; then
mkdir UU
fi
cd UU
fi
case "$1" in
-d) shift; fastread='yes';;
esac
d_eunice=''
eunicefix=''
define=''
loclist=''
expr=''
sed=''
echo=''
cat=''
rm=''
mv=''
cp=''
tail=''
tr=''
mkdir=''
sort=''
uniq=''
grep=''
trylist=''
test=''
inews=''
egrep=''
more=''
pg=''
Mcc=''
vi=''
mailx=''
mail=''
cpp=''
Log=''
Header=''
bin=''
cc=''
contains=''
cppstdin=''
cppminus=''
d_charsprf=''
d_flexfnam=''
d_index=''
d_voidsig=''
libc=''
mansrc=''
manext=''
models=''
split=''
small=''
medium=''
large=''
huge=''
ccflags=''
ldflags=''
n=''
c=''
package=''
registers=''
reg1=''
reg2=''
reg3=''
reg4=''
reg5=''
reg6=''
reg7=''
reg8=''
reg9=''
reg10=''
reg11=''
reg12=''
reg13=''
reg14=''
reg15=''
reg16=''
spitshell=''
shsharp=''
sharpbang=''
startsh=''
voidflags=''
defvoidused=''
CONFIG=''
: set package name
package=patch
echo " "
echo "Beginning of configuration questions for $package kit."
: Eunice requires " " instead of "", can you believe it
echo " "
define='define'
undef='/*undef'
libpth='/usr/lib /usr/local/lib /lib'
smallmach='pdp11 i8086 z8000 i80286 iAPX286'
rmlist='kit[1-9]isdone kit[1-9][0-9]isdone'
trap 'echo " "; rm -f $rmlist; exit 1' 1 2 3
: We must find out about Eunice early
eunicefix=':'
if test -f /etc/unixtovms; then
eunicefix=/etc/unixtovms
fi
if test -f /etc/unixtovms.exe; then
eunicefix=/etc/unixtovms.exe
fi
attrlist="mc68000 sun gcos unix ibm gimpel interdata tss os mert pyr"
attrlist="$attrlist vax pdp11 i8086 z8000 u3b2 u3b5 u3b20 u3b200"
attrlist="$attrlist ns32000 ns16000 iAPX286 mc300 mc500 mc700 sparc"
attrlist="$attrlist nsc32000 sinix xenix venix posix ansi M_XENIX"
attrlist="$attrlist $mc68k __STDC__"
pth="/usr/ucb /bin /usr/bin /usr/local /usr/local/bin /usr/lbin /etc /usr/lib /lib"
d_newshome="../../NeWS"
defvoidused=7
: some greps do not return status, grrr.
echo "grimblepritz" >grimble
if grep blurfldyick grimble >/dev/null 2>&1 ; then
contains=contains
elif grep grimblepritz grimble >/dev/null 2>&1 ; then
contains=grep
else
contains=contains
fi
rm -f grimble
: the following should work in any shell
case "$contains" in
contains*)
echo " "
echo "AGH! Grep doesn't return a status. Attempting remedial action."
cat >contains <<'EOSS'
grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
EOSS
chmod +x contains
esac
: first determine how to suppress newline on echo command
echo "Checking echo to see how to suppress newlines..."
(echo "hi there\c" ; echo " ") >.echotmp
if $contains c .echotmp >/dev/null 2>&1 ; then
echo "...using -n."
n='-n'
c=''
else
cat <<'EOM'
...using \c
EOM
n=''
c='\c'
fi
echo $n "Type carriage return to continue. Your cursor should be here-->$c"
read ans
rm -f .echotmp
: now set up to do reads with possible shell escape and default assignment
cat <<EOSC >myread
case "\$fastread" in
yes) ans=''; echo " " ;;
*) ans='!';;
esac
while expr "X\$ans" : "X!" >/dev/null; do
read ans
case "\$ans" in
!)
sh
echo " "
echo $n "\$rp $c"
;;
!*)
set \`expr "X\$ans" : "X!\(.*\)\$"\`
sh -c "\$*"
echo " "
echo $n "\$rp $c"
;;
esac
done
rp='Your answer:'
case "\$ans" in
'') ans="\$dflt";;
esac
EOSC
: general instructions
cat <<EOH
This installation shell script will examine your system and ask you questions
to determine how the $package package should be installed. If you get stuck
on a question, you may use a ! shell escape to start a subshell or execute
a command. Many of the questions will have default answers in square
brackets--typing carriage return will give you the default.
On some of the questions which ask for file or directory names you are
allowed to use the ~name construct to specify the login directory belonging
to "name", even if you don't have a shell which knows about that. Questions
where this is allowed will be marked "(~name ok)".
EOH
rp="[Type carriage return to continue]"
echo $n "$rp $c"
. myread
cat <<EOH
Much effort has been expended to ensure that this shell script will run
on any Unix system. If despite that it blows up on you, your best bet is
to edit Configure and run it again. Also, let me (lwall@jpl-devvax.jpl.nasa.gov)
know how I blew it. If you can't run Configure for some reason, you'll have
to generate a config.sh file by hand.
This installation script affects things in two ways: 1) it may do direct
variable substitutions on some of the files included in this kit, and
2) it builds a config.h file for inclusion in C programs. You may edit
any of these files as the need arises after running this script.
If you make a mistake on a question, there is no easy way to back up to it
currently. The easiest thing to do is to edit config.sh and rerun all the
SH files. Configure will offer to let you do this before it runs the SH files.
EOH
rp="[Type carriage return to continue]"
echo $n "$rp $c"
. myread
: get old answers, if there is a config file out there
if test -f ../config.sh; then
echo " "
dflt=y
rp="I see a config.sh file. Did Configure make it on THIS system? [$dflt]"
echo $n "$rp $c"
. myread
case "$ans" in
n*) echo "OK, I'll ignore it.";;
*) echo "Fetching default answers from your old config.sh file..."
tmp="$n"
ans="$c"
. ../config.sh
n="$tmp"
c="$ans"
;;
esac
fi
: find out where common programs are
echo " "
echo "Locating common programs..."
cat <<EOSC >loc
$startsh
case \$# in
0) exit 1;;
esac
thing=\$1
shift
dflt=\$1
shift
for dir in \$*; do
case "\$thing" in
.)
if test -d \$dir/\$thing; then
echo \$dir
exit 0
fi
;;
*)
if test -f \$dir/\$thing; then
echo \$dir/\$thing
exit 0
elif test -f \$dir/\$thing.exe; then
: on Eunice apparently
echo \$dir/\$thing
exit 0
fi
;;
esac
done
echo \$dflt
exit 1
EOSC
chmod +x loc
$eunicefix loc
loclist="
expr
sed
echo
cat
rm
tr
grep
"
trylist="
test
Mcc
cpp
"
for file in $loclist; do
xxx=`loc $file $file $pth`
eval $file=$xxx
eval _$file=$xxx
case "$xxx" in
/*)
echo $file is in $xxx.
;;
*)
echo "I don't know where $file is. I hope it's in everyone's PATH."
;;
esac
done
echo " "
echo "Don't worry if any of the following aren't found..."
ans=offhand
for file in $trylist; do
xxx=`loc $file $file $pth`
eval $file=$xxx
eval _$file=$xxx
case "$xxx" in
/*)
echo $file is in $xxx.
;;
*)
echo "I don't see $file out there, $ans."
ans=either
;;
esac
done
case "$egrep" in
egrep)
echo "Substituting grep for egrep."
egrep=$grep
;;
esac